package com.chaokang.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController

public class PraController {
    @Resource
    private RestTemplate restTemplate;
    //访问微服务地址  由微服务进行负载均衡
    @Value("${service-url.nacos-user-service}")
    private String serverUrl;
    @GetMapping("/pra02")
    public String getPra02(){
        return  restTemplate.getForObject(serverUrl+"/pra01",String.class);
    }
    @GetMapping("/pra03")
    public String getPra03(){
        return  "asdddddddddddddddddddddddd";
    }
}
